import request from '../utils/request'

export function login(data) {
  return request({
    url: '/users/login',
    method: 'post',
    data: {
      username: data.username,
      password: data.password
    }
  })
}

export function register(data) {
  return request({
    url: '/users/register',
    method: 'post',
    data: {
      username: data.username,
      password: data.password,
      email: data.email,
      phone: data.phone,
      gender: data.gender
    }
  })
}

export function updateUserInfo(id, data) {
  return request({
    url: `/users/${id}`,
    method: 'put',
    data: {
      email: data.email,
      phone: data.phone,
      gender: data.gender
    }
  })
}

export function updatePassword(userId, data) {
  return request({
    url: `/users/${userId}/password`,
    method: 'put',
    data
  })
} 